import ZCSelect from "../zc-select/zc-select";
import Zcdatepicker from "../zc-datepicker/zcd-datepick";
import ZCRangePicker from "../zc-rangepicker/zc-rangePicker";
import ZCCascader from "../zc-cascader/zc-cascader";

import ZCTextArea from "../zc-textArea/zc-textArea";
import { Input } from "antd";
import XxtreeSelect from "../zc-treeSelect/authTreeSelect";

// 根据type值判断返回Input框还是Select框还是别的.
export const showValueType = ({ form, componenttype, useprops }) => {
    switch (componenttype) {
        // 如果是Select，则渲染select组件并且遍历Options   optionlist={optionlist}
        case "Select": return <ZCSelect {...useprops} onSelect={value => form.setFieldsValue({ state: value })} />;
        case "DatePicker": return <Zcdatepicker {...useprops} />;
        case "RangePicker": return <ZCRangePicker {...useprops} onSelect={value => form.setFieldsValue({ state: value })} />;
        case "Cascader": return <ZCCascader {...useprops} onSelect={value => form.setFieldsValue({ state: value })} />;
        case "TextArea": return <ZCTextArea  {...useprops} onSelect={value => form.setFieldsValue({ state: value })} />;
        case "TreeSelect": return <XxtreeSelect  {...useprops} onSelect={value => form.setFieldsValue({ state: value })} />
        // 默认渲染Input组件
        default: return <Input value={"input text"} allowClear {...useprops} />;
    }
}